package com.day20.ex07;

public class SellTicket implements Runnable{
    private  int ticket = 100;
    @Override
    public void run() {
        while (true){
            if (ticket>0){
                try{
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName()+"正在出售第"+ticket+"张票");
                ticket--;
            }
        }
    }
}
